class Solution {
public:
    int countNumbersWithUniqueDigits(int n) {
        if(!n)return 1;
        int sum[9] = {10, 81};
        int up = 8;
        int ans = 0;
        for(int i = 2; i < n; i++){
            sum[i] = sum[i - 1] * up--;
        }
        for(int i = 0; i < n; i++)ans += sum[i];
        return ans;
    }
};

/**
 * @brief 2022.4.11
 * 找规律
 * 
 */